In the same way i want to display 20 records for each page in MVC4?
How can i do this?
@model IEnumerable<Hoda.Models.Products>Present i am using to display all records above code,
@{
ViewBag.Title = "products";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<p>
@Html.ActionLink("Create", "Create")
{
</p>
<table class="table table-striped" style="width:auto">
<tr>
<th>
@Html.DisplayNameFor(model => model.No)
</th>
<th>
@Html.DisplayNameFor(model => model.ProductName)
</th>
<th>
@Html.DisplayNameFor(model => model.Specifications)
</th>
<th>
@Html.DisplayNameFor(model => model.Quality_ValueAnalysis)
</th>
<th>
@Html.DisplayNameFor(model => model.Aboutus)
</th>
<th>
@Html.DisplayNameFor(model => model.Price)
</th>
</tr>
@if (Model.Count() == 0)
{
<tr>
<td colspan="4">No rows match for this search</td>
</tr>
}
else
{
foreach (var item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.No)
</td>
<td>
@Html.DisplayFor(modelItem => item.ProductName)
</td>
<td>
@Html.Raw(item.Specifications)
</td>
<td>
@Html.Raw(item.Quality_ValueAnalysis)
</td>
<td>
@Html.Raw(item.Aboutus)
</td>
@*<td>
@Html.Raw(item.Reviews)
</td>*@
<td>
@Html.DisplayFor(modelItem => item.Price)
</td>
<td>
@Html.ActionLink("Edit", "Edit", new { id = item.TagNo })
@Html.ActionLink("Details", "Newcars", new { id = item.TagNo})
</td>
</tr>
}
}
</table>
cs
public ActionResult Index()
{
var styles = from s in db.demoproducts select s;
return View(styles);
}
Abhishek Singh
22-Jan-2014